type ChartData = { xData: string[]; yData: number[] };

export const getEchartConfig = (chartData: ChartData) => {
  const { xData, yData } = chartData;
  return {
    color: ['#666666'],
    tooltip: {
      trigger: 'axis',
      axisPointer: {
        type: 'line', // 默认为直线，可选为：'line' | 'shadow'
      },
      formatter(params: any) {
        return params[0].value;
      },
    },
    grid: {
      top: '10%',
      left: '-9%',
      right: '0%',
      bottom: '5%',
      containLabel: true,
    },
    xAxis: {
      type: 'category',
      axisTick: {
        show: false,
      },
      data: xData,
    },
    yAxis: {
      show: false,
    },
    series: [
      {
        data: yData,
        type: 'line',
        lineStyle: {
          color: '#666666',
        },
        symbol: 'circle',
        emphasis: {
          scale: true,
          itemStyle: {
            borderColor: '#666666',
          },
        },
      },
    ],
  };
};
